package combat;

import java.util.HashMap;

import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;

public class BleedManager {
	private static HashMap<Player, HashMap<LivingEntity, Bleed>> bleeds = new HashMap<Player, HashMap<LivingEntity, Bleed>>();
	private static boolean bleeding = false;

	public static boolean bleeding() {
		return bleeding;
	}

	public static void check(Player damager, LivingEntity target) {
		if (bleeds.containsKey(damager)) {
			if (bleeds.get(damager).containsKey(target)) {
				bleeds.get(damager).get(target).reset();
			}
		} 
		else {
			HashMap<LivingEntity, Bleed> bleed = new HashMap<LivingEntity, Bleed>();
			bleed.put(target, new Bleed(damager, target));
			bleeds.put(damager, bleed);
		}
	}

	public static void removeBleed(Player player) {
		bleeds.remove(player);
	}

	public static void setBleeding(boolean bleed) {
		bleeding = bleed;
	}
}
